/**
 * A到B=12m A到E=15m A到D=6m B到E=5m E到F=7m D到C=11m C到G=2m C到F=7m G到F=3m  其他的路不通
 */
public class Test2 {
    public static void main(String[] args) {
        int[] arr1 = {12,5,7};
        int[] arr2 = {15,7};
        int[] arr3 = {6,11,7};
        int[] arr4 = {6,11,2,3};
        int num1=0;
        int num2=0;
        int num3=0;
        int num4=0;
        for (int i : arr1) {
            num1+=i;
        }
        for (int i : arr2) {
            num2+=i;
        }
        for (int i : arr3) {
            num3+=i;
        }
        for (int i : arr4) {
            num4+=i;
        }
        int[] Arr = {num1,num2,num3,num4};
        String[] Arr1 = {"ABEF","AEF","ADCF","ADCGF"};
        for (int i = 0; i < Arr.length-1; i++) {
            for (int j = 0; j < Arr.length-1-i; j++) {
                if (Arr[j]>Arr[j+1]){
                    int temp = Arr[j];
                    Arr[j] = Arr[j+1];
                    Arr[j+1] = temp;
                    String temp1 = Arr1[j];
                    Arr1[j] = Arr1[j+1];
                    Arr1[j+1] = temp1;
                }
            }
        }
        System.out.println("A到F的最短路径"+Arr[0]);
        System.out.println("顺利节点"+Arr1[0]);
    }
}
